package main

import "fmt"

func main() {
	v := Vertex{1, 2}
	v.X = 4
	fmt.Println(v)

	v1 := Vertex{X: 1, Y: 2}
	// Y is implicit
	v2 := Vertex{X: 1}
	fmt.Println(v1, v2)

	// Doing v.X is the same as doing (*v).X, when v is a pointer.
	v3 := &Vertex{1, 2}
	v3.X = 2
	fmt.Println(v3)

	m := make(map[string]int)
	m["k1"] = 7
	m["k2"] = 13
	fmt.Println(m)
	v4 := m["k1"]
	// => 7
	fmt.Println(v4)
	// => 2
	fmt.Println(len(m))
	delete(m, "k2")
	// => map[k1:7]
	fmt.Println(m)
	_, prs := m["k2"]
	// => false
	fmt.Println(prs)

	n := map[string]int{"foo": 1, "bar": 2}
	// => map[bar:2 foo:1]
	fmt.Println(n)
}

type Vertex struct {
	X float64
	Y float64
}
